package com.creditease.shield.flow.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.creditease.shield.flow.cache.CacheContainer;
import com.creditease.shield.flow.pojo.KeyBankPO;
import com.creditease.shield.flow.service.CounterService;
import com.creditease.shield.flow.service.KeyBankService;

/**
 * 读取key_bank
 * @author 201505130123
 *
 */
@Service
public class CounterServiceImpl implements CounterService {

	@Autowired
	private KeyBankService keyBankService;
	
	@Override
	public String getTableId(String tableName) {
		String tableId = keyBankService.createKey(tableName);
		
		return tableId;
	}
	
	@Override
	public String getFlowNo(String keyName) {
		
		CacheContainer cache = CacheContainer.getInstance(); 
		
		KeyBankPO basekey = (KeyBankPO)cache.get("flowNoCache", keyName);
			
		return keyBankService.createKey(keyName);
		
		
	}
	

	@Override
	public long getLongNo(String keyName) {
	
		return keyBankService.createKeyAsLong(keyName);
	}
	

}
